package com.sihai.ehr.model.biz;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

import com.sihai.core.BaseEntity;
import com.sihai.ehr.model.sys.AuditStatus;
import com.sihai.ehr.model.sys.Organization;

/**
 * 培训计划实体对象
 * 
 * @author henry
 * 
 */
@Entity
public class TrainPlan extends BaseEntity<Long> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;

	/** 组织结构ID */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "organization_id")
	private Organization organization;

	/** 职务 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "duty_id")
	private Duty duty;

	/** 标题 */
	private String title;
	/** 培训日期 */
	private Date trainStartDate;
	/** 培训时间 */
	private Date trainEndDate;
	/** 原计划日期 */
	private Date planStartDate;
	private Date planEndDate;
	private Date amendStartDate; // 更正日期
	private Date amendEndDate; // 更正时间
	private String amendReason; // 更正原因
	// /** 培训对象集合 */
	// @OneToMany(cascade = { CascadeType.ALL }, mappedBy = "trainPlan")
	// private Set<TrainPlanTarget> planTargets = new
	// HashSet<TrainPlanTarget>();
	/** 培训类型 */
	private String category;
	private String classroom;
	/** 讲师 */
	@OneToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "lecturer_id")
	private TrainLecturer trainLecturer; // 内训教师
	private String outingLecturer; // 外训教师
	private String outingCharge; // 外训费用类型
	private Float outingExpectCharge;	//外训预计费用
	private String outingApplyReason; // 外训申请理由
	private String outingFeedback; // 外训受训反馈需求
	private int lecturerType; // 讲师类型:0-内聘，1-外聘
	private String remark; // 备注
	/** 培训教育课件资源 */
	@OneToMany(cascade = { CascadeType.ALL }, mappedBy = "trainPlan")
	private Set<TrainMaterResource> materResources = new HashSet<TrainMaterResource>();
	private Date lastuploadDate; // 上传日期
	/** 培训教具资源 */
	// @OneToMany(cascade = { CascadeType.ALL }, mappedBy = "trainPlan")
	@ManyToMany(targetEntity = TrainRealiaResource.class, cascade = { CascadeType.ALL })
	@JoinTable(name = "train_plan_realia_resource", joinColumns = @JoinColumn(name = "plan_id"), inverseJoinColumns = @JoinColumn(name = "realia_id"))
	private Set<TrainRealiaResource> realiaResources = new HashSet<TrainRealiaResource>();
	private String externRealiaDesc; // 申请额外教具
	private AuditStatus auditStatus;	//培训审核
	private AuditStatus closeAuditStatus;	//外训结案审核
	private int sendMsgStatus; // 0-未发，1-已发送信息
	private int cancel; //0: 正常 1:取消
	private String cancelReason; // 取消原因
	private int closeAuditNum;	//结案审核数
	private int status;	//是否正常 0:正常,1:删除

	@Override
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Organization getOrganization() {
		return organization;
	}

	public void setOrganization(Organization organization) {
		this.organization = organization;
	}

	public Duty getDuty() {
		return duty;
	}

	public void setDuty(Duty duty) {
		this.duty = duty;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public Date getTrainStartDate() {
		return trainStartDate;
	}

	public void setTrainStartDate(Date trainStartDate) {
		this.trainStartDate = trainStartDate;
	}

	public Date getTrainEndDate() {
		return trainEndDate;
	}

	public void setTrainEndDate(Date trainEndDate) {
		this.trainEndDate = trainEndDate;
	}

	public Date getPlanStartDate() {
		return planStartDate;
	}

	public void setPlanStartDate(Date planStartDate) {
		this.planStartDate = planStartDate;
	}

	public Date getPlanEndDate() {
		return planEndDate;
	}

	public void setPlanEndDate(Date planEndDate) {
		this.planEndDate = planEndDate;
	}

	public Date getAmendStartDate() {
		return amendStartDate;
	}

	public void setAmendStartDate(Date amendStartDate) {
		this.amendStartDate = amendStartDate;
	}

	public Date getAmendEndDate() {
		return amendEndDate;
	}

	public void setAmendEndDate(Date amendEndDate) {
		this.amendEndDate = amendEndDate;
	}

	public String getAmendReason() {
		return amendReason;
	}

	public void setAmendReason(String amendReason) {
		this.amendReason = amendReason;
	}

	public String getCategory() {
		return category;
	}

	public void setCategory(String category) {
		this.category = category;
	}

	public String getClassroom() {
		return classroom;
	}

	public void setClassroom(String classroom) {
		this.classroom = classroom;
	}

	public TrainLecturer getTrainLecturer() {
		return trainLecturer;
	}

	public void setTrainLecturer(TrainLecturer trainLecturer) {
		this.trainLecturer = trainLecturer;
	}

	public String getOutingLecturer() {
		return outingLecturer;
	}

	public void setOutingLecturer(String outingLecturer) {
		this.outingLecturer = outingLecturer;
	}

	public String getOutingCharge() {
		return outingCharge;
	}

	public void setOutingCharge(String outingCharge) {
		this.outingCharge = outingCharge;
	}
	
	public Float getOutingExpectCharge() {
		return outingExpectCharge;
	}
	
	public void setOutingExpectCharge(Float outingExpectCharge) {
		this.outingExpectCharge = outingExpectCharge;
	}

	public String getOutingApplyReason() {
		return outingApplyReason;
	}

	public void setOutingApplyReason(String outingApplyReason) {
		this.outingApplyReason = outingApplyReason;
	}
	
	public String getOutingFeedback() {
		return outingFeedback;
	}
	
	public void setOutingFeedback(String outingFeedback) {
		this.outingFeedback = outingFeedback;
	}

	public int getLecturerType() {
		return lecturerType;
	}

	public void setLecturerType(int lecturerType) {
		this.lecturerType = lecturerType;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public Set<TrainMaterResource> getMaterResources() {
		return materResources;
	}

	public void setMaterResources(Set<TrainMaterResource> materResources) {
		this.materResources = materResources;
	}

	public Date getLastuploadDate() {
		return lastuploadDate;
	}

	public void setLastuploadDate(Date lastuploadDate) {
		this.lastuploadDate = lastuploadDate;
	}

	public Set<TrainRealiaResource> getRealiaResources() {
		return realiaResources;
	}

	// public void setRealiaResources(Set<TrainRealiaResource> realiaResources)
	// {
	// this.realiaResources = realiaResources;
	// }

	public String getExternRealiaDesc() {
		return externRealiaDesc;
	}

	public void setExternRealiaDesc(String externRealiaDesc) {
		this.externRealiaDesc = externRealiaDesc;
	}

	public AuditStatus getAuditStatus() {
		return auditStatus;
	}

	public void setAuditStatus(AuditStatus auditStatus) {
		this.auditStatus = auditStatus;
	}
	
	public AuditStatus getCloseAuditStatus() {
		return closeAuditStatus;
	}
	
	public void setCloseAuditStatus(AuditStatus closeAuditStatus) {
		this.closeAuditStatus = closeAuditStatus;
	}

	public int getSendMsgStatus() {
		return sendMsgStatus;
	}

	public void setSendMsgStatus(int sendMsgStatus) {
		this.sendMsgStatus = sendMsgStatus;
	}

	public int getCancel() {
		return cancel;
	}

	public void setCancel(int cancel) {
		this.cancel = cancel;
	}

	public String getCancelReason() {
		return cancelReason;
	}

	public void setCancelReason(String cancelReason) {
		this.cancelReason = cancelReason;
	}
	
	public int getCloseAuditNum() {
		return closeAuditNum;
	}
	
	public void setCloseAuditNum(int closeAuditNum) {
		this.closeAuditNum = closeAuditNum;
	}
	
	public int getStatus() {
		return status;
	}
	
	public void setStatus(int status) {
		this.status = status;
	}
}
